package com.onpositive.notes.argumnets;

import java.util.Locale;

import com.onpositive.notes.impl.AbstractEntityWithClass;
import com.onpositive.notes.model.IArgumentLabelProvider;
import com.onpositive.notes.model.IArgumentModel;
import com.onpositive.notes.model.ITemplateArgument;

public abstract class BasicArgumentModel<C,T extends AbstractTemplateArgument<C>> extends AbstractEntityWithClass<C> implements IArgumentModel<C,T> {

	public BasicArgumentModel() {
		super();
	}

	private static final long serialVersionUID = 3357974073364551237L;

	public BasicArgumentModel(Class<C> clazz, String name, IArgumentLabelProvider<C> labelProvider, boolean isRequired) {
		super(clazz);
		this.name = name ;
		this.labelProvider = labelProvider ;
		this.isRequired = isRequired ;
	}
	
	private String name ;
	private IArgumentLabelProvider<C> labelProvider ;
	protected boolean isRequired ;
	int id ;

	@Override
	public String getName() {
		return name ;
	}

	@Override
	public String getLabel(ITemplateArgument<C> arg) {
		return labelProvider.computeLabel( arg ) ;
	}

	@Override
	public String getLabel(ITemplateArgument<C> arg, Locale locale) {
		return labelProvider.computeLabel( arg, locale ) ;
	}

	@Override
	public boolean isRequired() {
		return isRequired;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
}
